/*
 *
 * Copyright(c) TODO
 * licensing@realtor.org
 * http://www.realtor.org/license
 */

function fn_logout()
{
	document.location = AD.Globals.URL_session + 'logout';
};

function make_cb(lbl, name, store, default_value)
{
	var cb = new Ext.form.ComboBox(
	{
		id : name,
		name : name,
		store : store,
		fieldLabel : lbl,
		value : default_value,
		width : AD.Globals.field_width,
		valueField : 'key',
		displayField : 'value',
		typeAhead: true,
		selectOnFocus:true,
		triggerAction:'all',
		mode : 'local',
		lazyRender : true

	});
	return cb;
}

function make_txt(lbl, name, default_value)
{
	var txt = new Ext.form.TextField(
	{
		id : name,
		name : name,
		fieldLabel : lbl,
		value : default_value,
		width : AD.Globals.field_width
	});
	return txt;
}

function enable_field(fld_id, bEnable)
{
	var fld = Ext.getCmp(fld_id);
	if(true === bEnable)
	{
		fld.enable();
	}
	else
	{
		fld.disable();
	}
}
function set_cookie(cn, cv)
{
	 var now = new Date();
	 var exp = new Date();
	 exp.setTime(now.getTime() + 3600000*24*30);
	 document.cookie = cn+"="+escape(cv) + ";expires=" + exp.toGMTString();
}


function get_cookie(cn) {
	 var ck=""+document.cookie;

	 var ind=ck.indexOf(cn);
	 if (ind==-1 || cn=="") return "";

	 var ind1=ck.indexOf(';',ind);
	 if (ind1==-1) ind1=ck.length;

	 return unescape(ck.substring(ind+cn.length+1,ind1));
	}

